import random

def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press ⌘F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':

    #根据QA与QB生成可选队员列表'''
    h = 12
    listqa = [0] * 10
    listqb = [0] * 10
    listNum = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    j = 0

    for i in range(0, 10):
        qa = random.randint(1, 200)  #随机抽取一个数字QA
        qb = random.randint(1, 200)  # 随机抽取一个数字Qb
        if (qa > h and qb > h):
            if(abs(qa-qb) > h):
                     listqa[j] = qa
                     listqb[j] = qb
                     j=j+1
    print('题目：选取队员')
    print('step1:筛选10个200内随机数')
    print('    输出qa: ', listqa) #输出qb
    print('    输出qb: ', listqb) #输出qb


    #找listqb最大值,并转换
    for i in range(10):
        indexNum = i
        for j in range(0, 10-i-1):
            if(listqb[j] < listqb[j+1]):
                listqb[j], listqb[j+1] = listqb[j+1], listqb[j]  #qb交换最大值
                listqa[j], listqa[j+1] = listqa[j+1], listqa[j]  # qb交换最大值
                listNum[j], listNum[j+1] = listNum[j+1], listNum[j] #同步交换编号
    print('step2:筛选出符合调节的随机数并降序排列(按qb)')
    print('    输出qa: ', listqa) #输出qa
    print('    输出qb: ', listqb) #输出qb
    print('step3:综上得出符合两位队员的编号')
    print('    第一位队员: 编号-', listNum[0], '  qa值-', listqa[0], '  qb值-', listqb[0])
    print('    第二位队员: 编号-', listNum[1], '  qa值-', listqa[1], '  qb值-', listqb[1])

